<template>
	<view class='container'>
		<view class="position-f header uni-flex uni-row flex-between">
			<uni-nav-bar title="版本信息">
				<template slot='left'>
					<view class="flex width-100">
						<i class='iconfont iconfanhui' @click='goBack()'></i>
					</view>
				</template>
			</uni-nav-bar>
		</view>
		<view class="content-info pd-t-80 bg-w p-20">
			<view class="info-top text-a-c p-20 border-bottom ">
				<view class="logo-img flex algin-i-c flex-center-h">
					<view class="img">
						
					</view>
				</view>
				<view class="fb margin-t-20">
					项目全生命周期APP
				</view>
				<view class="fs-14">
					v0.0.0
				</view>
			</view>
			<view class="info-bottom">
				<view class="message uni-label margin-b-10" v-for="(item,index) in 10" :key="index">
					<span class="circle"></span>{{message}}
				</view>
			</view>
		</view>
		<view class="uni-btn-v">
			<button class="fs-14" link @click="newVersion">发现新版本，立即更新</button>
		</view>
	</view>
</template>

<script>
import {version,lastestVersion} from '@/common/api/profile.js'
	export default {
		data() {
			return {
				message:"更新xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
			}
		},
		created() {
			this.getVersion();
		},
		methods: {
			
			getVersion(){
				let id =+ uni.getStorageSync('user_info').id;
				// id+=id;
				console.log(id)
				version(id).then( res => {
					console.log(res)
				})
			},
			newVersion(){
				lastestVersion().then(res => {
					if(res.code === "20000"){
						let url = res.data.downloadLink;
						console.log(url)
						uni.downloadFile({
							url:url,
							success:res1 => {
								console.log(res1)
								if (res1.statusCode === 200) {
								            uni.showToast({
								            	title:"下载成功",
												duration:2000
								            })
								        }
							}
						})
					}
				})
			}
		}
	}
</script>

<style scoped>
.info-bottom{height: 350px;overflow: auto;}
.img{width: 80px;height: 80px;background-color: #007AFF;border-radius: 5px;}
.message{width: 100%;position: relative;padding: 10px 14px;box-sizing: border-box;}
.circle{width: 10px;height: 10px;border-radius: 50%;background-color: #007AFF;position: absolute;top: 50%;left: 0;transform: translateY(-50%);}
.uni-btn-v{position: fixed;bottom: 10px;left: 0;right: 0;padding: 0 10px;background-color: #FFF;}
.uni-btn-v button{background-color: rgba(9, 170, 233, 1);border-radius: 20px; color: #fff;}
</style>
